/**
 * Copyright ©2016-2020 northkingbpo Corporation, All Rights Reserved
 * http://www.northkingbpo.net/
 */

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

/**
 * class info
 *
 * @author hujia
 * @date 2018/11/9 08:06
 */
public class StartUp {

    public static void main(String args[]) {
        JedisConfig jedisConfig = new JedisConfig();
        JedisPool jedisPool = jedisConfig.redisPoolFactory();
        test(jedisPool);
        test(jedisPool);
    }


    private static void test(JedisPool jedisPool) {
        long startTimeOut = System.currentTimeMillis();
        Jedis jedis = jedisPool.getResource();
        for (int i = 0; i < 10; ++i) {
            System.out.println("begin");
            long startTime = System.currentTimeMillis();
            jedis.get("test");
            long endTime = System.currentTimeMillis();
            System.out.println("get cost time is :" + (endTime - startTime) + " ms");
        }
        jedis.close();
        long endTimeOut = System.currentTimeMillis();
        System.out.println("out cost time is :" + (endTimeOut - startTimeOut) + " ms");
    }
}
